package com.demo.mapper;

import com.demo.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface TestMapper {

    //加锁的方法
    @Insert("INSERT INTO tb_lock_demo(demo) values(#{lock})")
    int addLock(@Param("lock") String lock);
    //是否锁的方法
    @Delete("delete from tb_lock_demo where demo=#{lock}")
    void deleteLock(@Param("lock") String lock);
    //修改金额的方法
    @Update("UPDATE  tb_user SET money=money-#{money} where id=#{id}")
    int updateMoney(@Param("id") Integer id, @Param("money") double money);
    //查询金额的方法
    @Select("SELECT * FROM tb_user where id=#{id}")
    User getUser(Integer id);

}
